//封装localStorage
export const Storage = {
  get(key) {
    if (
      window.localStorage.getItem(key) &&
      window.localStorage.getItem(key) !== 'undefined'
    ) {
      return JSON.parse(window.localStorage.getItem(key));
    } else {
      return null;
    }
  },
  set(key, value) {
    window.localStorage.setItem(key, JSON.stringify(value));
  },
  remove(key) {
    window.localStorage.removeItem(key);
  },
  clear() {
    window.localStorage.clear();
  },
};
export default Storage;
